/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.strategy.mapper;

import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper;
import com.pig4cloud.pigx.strategy.dto.StrategySwitchContractConditionDTO;
import com.pig4cloud.pigx.strategy.entity.StrategySwitchContract;
import com.pig4cloud.pigx.strategy.vo.StrategySwitchContractVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 策略开关-合约
 *
 * @since 2022-11-24 10:39:27
 */
@Mapper
public interface StrategySwitchContractMapper extends PigxBaseMapper<StrategySwitchContract> {

    /**
     * 分页查询总数
     *
     * @param condition 查询条件
     * @return {@link  int}
     * @since 2023/2/13 10:05
     */
    int pageCount(@Param("condition") StrategySwitchContractConditionDTO condition);

    /**
     * 分页查询
     *
     * @param condition  查询条件
     * @param startIndex 起始下标
     * @param endIndex   结束下标
     * @return {@link  List< StrategySwitchContractVO>}
     * @since 2023/2/13 10:05
     */
    List<StrategySwitchContractVO> page(@Param("condition") StrategySwitchContractConditionDTO condition,
                                        @Param("startIndex") int startIndex,
                                        @Param("endIndex") int endIndex);

    /**
     * 新增
     *
     * @param entity 数据
     * @return {@link int}
     * @since 2022/11/28 11:16
     */
    int add(StrategySwitchContract entity);

    /**
     * 根据策略id和状态查询id集合
     * <p>从旧到新
     *
     * @param strategyId 策略id
     * @param status     状态
     * @param startIndex 起始下标
     * @param endIndex   结束下标
     * @return {@link List< Long>}
     * @since 2022/12/10 11:46
     */
    List<Long> getIdListByStrategyIdAndStatus(@Param("strategyId") Long strategyId,
                                              @Param("status") String status,
                                              @Param("startIndex") int startIndex,
                                              @Param("endIndex") int endIndex);
}
